﻿<%@ Page Language="C#" AutoEventWireup="true" Codebehind="ListPositionLog.aspx.cs"
    Inherits="LabMS.Web.LabPersonnel.ListPositionLog" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>个人岗位日志列表</title>
    <link type="text/css" rel="stylesheet" href="../style/screen.css" />
    <!--[if lte IE 6]>
    <link type="text/css" rel="stylesheet" href="../style/ie6.css" />
    <![endif]-->
    <!--[if lte IE 7]>
    <link type="text/css" rel="stylesheet" href="../style/ie7.css" />
    <![endif]-->

    <script type="text/javascript" src="../../js/Calendar5.js"></script>

    <script type="text/javascript" src="../../js/Common.js"></script>

    <script type="text/javascript">
    var d = new Calendar("d");
    document.write(d);
    </script>

</head>
<body class="mainBody">
    <form id="form1" runat="server">
        <div class="main">
            <div id="pageInfo" class="clearfix">
                <div class="title">
                    <label>
                        个人岗位日志列表</label>
                </div>
            </div>
        </div>
        <div class="main">
            <p>
                <%--<asp:CheckBox ID="checkall" runat="server" Font-Size="9pt" Text="全选" />--%>
                <input type="button" id="btnAddPLog" runat="server" onclick="RedirectURL(window,'AddPositionLog.aspx')"
                    value="添加" class="button" />
                <asp:Button ID="DeleteBtn" Text="删除" runat="server" OnClick="Delete_OnClick" CssClass="button" />
            </p>
            <p>
                日志时间：<asp:TextBox ID="PLogKeyWordTime1" runat="server"></asp:TextBox>
                --
                <asp:TextBox ID="PLogKeyWordTime2" runat="server"></asp:TextBox>
                <asp:Button ID="btSearch" CssClass="button" runat="server" Text="搜索" OnClick="btSearch_Click" />
            </p>
        </div>
        <div class="main">
            <asp:GridView ID="gvPositionLogList" AutoGenerateColumns="false" AllowPaging="true"
                Width="100%" PageSize="15" DataKeyNames="ID" OnPageIndexChanging="GridViewPLog_PageIndexChanging"
                OnRowDataBound="GridViewPLog_RowDataBound" runat="server" CssClass="infoTable">
                <Columns>
                    <asp:TemplateField ItemStyle-CssClass="checkBox">
                        <HeaderTemplate>
                            <asp:CheckBox ID="CBAll" runat="server" />
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:CheckBox ID="PositionLogCB" runat="server" />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="PLog_TeacherCode" HeaderText="教师编号" />
                    <asp:BoundField DataField="PLog_TeacherName" HeaderText="教师名称" />
                    <asp:BoundField DataField="PLog_Time" DataFormatString="{0:yyyy-MM-dd}" HeaderText="记录时间" />
                    <asp:BoundField DataField="PLog_IP" HeaderText="记录IP" />
                    <asp:BoundField DataField="PLog_LabIntro" HeaderText="内容简要" />
                    <asp:BoundField DataField="PLog_Equipment" HeaderText="仪器设备运行情况" />
                    <asp:BoundField DataField="PLog_Other" HeaderText="其他" />
                </Columns>
                <HeaderStyle CssClass="header" />
                <EmptyDataTemplate>
                    没有数据！
                </EmptyDataTemplate>
            </asp:GridView>
        </div>
    </form>

    <script type="text/javascript" src="../js/jQuery/jquery-1.3.1.js"></script>

    <script type="text/javascript">

        $(function(){
            /* 修改样式 */
            $("#gvPositionLogList > tbody > tr:even").not(":first").addClass("even");
            $("#gvPositionLogList > tbody > tr").not(":first")
                .hover(
                    function(){
                        $(this).addClass("hover");
                    },
                    function(){
                        $(this).removeClass("hover");
                });

            /* 全选 */
            $("#gvPositionLogList > tbody > tr:first :checkbox").click(function(){
                if ($(this).attr("checked")){
                    $("#gvPositionLogList :checkbox").attr("checked", "checked");
                    cbChanged();
                } else{
                    $("#gvPositionLogList :checkbox").attr("checked", "");
                    cbChanged();
                }
            });

            /* Checkbox事件 */
            $("#gvPositionLogList :checkbox").not(":first").click(cbChanged);

            $("#DeleteBtn").click(function(e){
                if (!confirm('您确认要删除所选人员?')) {
                    e.preventDefault();
                }
            });

            cbChanged();
        });

        /* 检测Checkbox的选择状态，更改button的disabled属性 */
        function cbChanged(){
            var hasChecked = false;
            var allChecked = true;
            $("#gvPositionLogList :checkbox").not(":first").each(function(index, domEle){
                var curChecked = $(domEle).attr("checked");
                if (!hasChecked && curChecked){
                    hasChecked = true;
                }

                allChecked &= curChecked;
            });

            if (hasChecked){
                $("#DeleteBtn").attr("disabled", "");
            } else {
                $("#DeleteBtn").attr("disabled", "disabled");
            }

            if (allChecked){
                $("#gvPositionLogList :checkbox").filter(":first").attr("checked", "checked");
            } else {
                $("#gvPositionLogList :checkbox").filter(":first").attr("checked", "");
            }
        }
    </script>

</body>
</html>
